{% extends "document_management/base.html" %}

{% block page_link %}
    <link rel="stylesheet" href="../../static/system_setup/css/style.css">
    <link rel="stylesheet" type="text/css" href="../../static/personal_center/css/index.css">
    <link rel="stylesheet" type="text/css" href="../../static/personal_center/css/common.css">
    <script type="text/javascript" src="../../static/personal_center/js/index.js"></script>
{% endblock %}

{% block style %}
    <style>
        .add_class {
            background: #1E90FF;
        }

        .button {
            width: 95px;
            height: 30px;
            border: #ccc solid 0.5px;
            border-radius: 3px;
            text-align: center;
            text-decoration: none;
            display: inline-block;
            font-size: 12px;
            -webkit-transition-duration: 0.4s; /* Safari */
            transition-duration: 0.4s;
            cursor: pointer;
        }

        .button4 {
            background-color: #e8e8e8;
            color: black;
            border: 0.5px solid #ccc;
        }

        .button4:hover {
            background-color: #e8e8e8;
            box-shadow: 0 12px 16px 0 rgba(0, 0, 0, 0.24), 0 17px 50px 0 rgba(0, 0, 0, 0.19);
        }

        .button4:active {
            box-shadow: 0 5px #666;
            transform: translateY(4px);
        }


        .add-backbround-color {
            border-left: #1E90FF solid 3px;
            color: #1E90FF;
        }

        ul li {
            list-style: none;
            display: inline-block;
        }

        #party_main_body[type=file] {
            cursor: inherit;
        }

        .add_background {
            background: #A9A9A9;
        }

        .search1 {
            width: 95%;
            display: flex;
            float: right;
            margin: 5.5px 0;
            margin-right: 1%;
            /*border: 1px solid red;*/
        }

        .search1 input {
            vertical-align: middle;
            float: left;
        / / 左浮动 flex: 4;
            height: 29px;
            width: 77%;
            outline: none;
            border: 1px solid #0070c1;
            box-sizing: border-box;
        / / 盒子模型，怪异IE盒子模型，width = content + border * 2 + padding * 2 padding-left: 10 px;
            border-bottom-left-radius: 5px;
            border-top-left-radius: 5px;
        }

        .search1 button {
            float: right;
            flex: 1;
            height: 29px;
            width: 23%;
            line-height: 29px;
            background-color: #0070c1;
            color: white;
            border-style: none;
            outline: none;
            border-bottom-right-radius: 5px;
            border-top-right-radius: 5px;
        }

        .search1 button i {
            font-style: normal;
        }

        .search1 button:hover {
            font-size: 16px;
        }

        .li-class {
            list-style: none;
            margin-top: 2%;
            color: #0b0b0b;
            cursor: pointer;
            width: 100%;
        }

        .div_clase {
            display: inline-block;
            width: 300px;
            height: 30px;
            line-height: 30px;
            font-size: 14px;
            color: #0b0b0b;
        }


        #title {
            display: flex;
            justify-content: space-between;
            box-sizing: border-box;
            padding: 0 10px;
            height: 50px;
            color: #0b0b0b;
            cursor: move;
            /*border: #dfdfdf solid 1px;*/
            width: 100%;
            background: #f4f7fa;
            border-top-left-radius: 5px;
            border-top-right-radius: 5px;
        }


        .my-select-box {
            position: relative;
        }

        .my-select-box .my-select-input {
            height: 24px;
            line-height: 24px;
            padding: 0 5px;
            background: url() right center no-repeat;
            padding-right: 20px !important;
            width: 100%;
            box-sizing: border-box;
        }

        .my-select-box .my-select-list {
            position: absolute;
            left: 0;
            z-index: 101;
            border: 1px solid #ccc;
            border-top: none;
            max-height: 120px;
            overflow-y: auto;
            display: none;
            background: #fff;
            width: 100%;
            box-sizing: border-box;
        }

        .my-select-box .my-select-list li {
            height: 22px;
            line-height: 22px;
            padding: 0 3px;
            cursor: pointer;
            margin-bottom: 1px
        }

        .my-select-box .my-select-list li.choosed {
            background: #ccc;
            color: #fff;
        }

        .my-select-box .my-select-list li:hover {
            background: #ccc;
            color: #fff;
        }

        .radio-inline_1 {
            margin-top: 7px;
            padding-right: 20px;
        }

        .file {
            position: relative;
            display: inline-block;
            background: #D0EEFF;
            border: 1px solid #99D3F5;
            border-top-left-radius: 4px;
            border-bottom-left-radius: 4px;
            padding: 4px 12px;
            overflow: hidden;
            color: #1E88C7;
            text-decoration: none;
            text-indent: 0;
            line-height: 20px;
        }

        .file input {
            position: absolute;
            font-size: 100px;
            right: 0;
            top: 0;
            opacity: 0;
        }

        .file:hover {
            background: #AADFFD;
            border-color: #78C3F3;
            color: #004974;
            text-decoration: none;
        }
    </style>
{% endblock %}


{% block right_content %}
    <div id="new_models" style="width: 80%;height: 80%;position: absolute;display: none;">
        <div id="box"
             style="width: 700px;height: 500px;background: white;z-index: 10100;position: absolute;top: 50%;left: 50%;transform:translate(-50%,-50%);border-radius: 3px;border: #cfcfcf solid 1px;">
            <div style="width: 100%;height: 50px;background: #f4f7fa;cursor: move;border-top-left-radius: 5px;border-top-right-radius: 5px;">
                <h5 id="model_title" class="modal-title"
                    style="line-height: 50px;width: 15%;margin-left: 1%;display: inline-block;"></h5>
                <button id="close-model" type="button" class="close" data-dismiss="modal" aria-label="Close"
                        style="margin-right: 3%;line-height: 50px;">
                    <span onclick="close_models()" aria-hidden="true" style="font-size: 28px;"><i
                            class="iconfont icon-quchu"></i></span>
                </button>
            </div>
            <hr>
            <div style="height: 400px;width: 100%;padding-top: 2%;padding-left: 2%;">
                <div style="display: inline-block;width: 30%;height: 100%;border-right: #E8E8E8 solid 1px;">
                    <div style="width: 100%;height: 35px;color: #0b0b0b;text-align: center;">
                        <div class="search1" style="vertical-align: center;">
                            <input type="text" placeholder="请输入..." name="" id="search_data" value="">
                            <button id="search_button">搜索</button>
                        </div>
                    </div>
                    <div style="width: 100%;height: 35px;line-height: 35px;padding-left: 2%;color: #0b0b0b;border-bottom: #cfcfcf solid 1px;">
                        <div id="an_branch"
                             style="width: 31.5%;display: inline-block;cursor: pointer;text-align: center;color: #01aaed;">
                            按部门
                        </div>
                        <div id="an_rank"
                             style="width: 31.5%;display: inline-block;cursor: pointer;text-align: center;">按权限
                        </div>
                        <div id="an_func"
                             style="width: 31.5%;display: inline-block;cursor: pointer;text-align: center;">按职能
                        </div>
                    </div>
                    <div id="department_list" style="width: 100%;height: 315px;overflow: auto;">
                        <div style="width: 100%;height: 100%;text-align: center;">
                            <img style="width: 30%;height: 30%;margin-top: 35%;"
                                 src="../../static/public_file/images/jiazai.gif" alt="">
                        </div>
                    </div>
                </div>

                <div style="display: inline-block;width: 68.5%;height: 100%;overflow: auto;vertical-align: top;left: 0;">

                    <table class="table table-hover table-bordered"
                           style="border-collapse: collapse;margin: 0;padding: 0;">

                        <thead>
                        <tr>
                            <th scope="col" style="width: 10%; text-align: center;">
                                <input id="all_select_checkbox" type="checkbox">
                            </th>
                            <th scope="col" style="width: 20%;text-align: center;">序号</th>
                            <th scope="col" style="width: 35%;text-align: center;">姓名</th>
                            <th scope="col" style="width: 35%;text-align: center;">工号</th>
                        </tr>
                        </thead>
                        <tbody style="overflow: auto;" id="t_table2"></tbody>
                    </table>
                    <div id="img-display1" style="width: 75%;text-align: center;">
                        <div style="margin-top: 10%;">
                            <img src="../../static/public_file/images/page-img/11.jpg" alt="">
                            <p style="margin: 0;padding: 0;vertical-align: top;">暂无数据</p>
                        </div>
                    </div>
                </div>

                <div style="height: 30%;width: 100%;border-top: #E8E8E8 solid 1px;overflow: auto;display: none;">
                    <div id="checked-label" style="margin-top: 1%;margin-left: 3%;width: 90%;">

                    </div>
                </div>
            </div>
            <hr>
            <div style="width: 100%;height: 50px;text-align: right;padding-right: 2%;">
                <button id="model-affirm"
                        style="width: 100px;height: 36px;border: #dfdfdf solid 1px;margin-top: 7px;border-radius: 3px;">
                    确认
                </button>
            </div>
        </div>
    </div>

    <div id="on_load"
         style="display: none; position: absolute; width: 350px; height: 450px; border-radius: 25px; top: 20%; left: 50%; background: #f4f5f3; box-shadow: #c1c1c1 5px 5px 2px; z-index: 100;">
        <div style="width: 100%; text-align: right; padding:15px 20px 0 0;"><span style="cursor: pointer;" onclick="close_models_1()">✖</span>
        </div>

        <div style="text-align: center; margin-top: 25px;"><h3>人员选择</h3></div>
        <div style="margin-bottom: 40px;margin-left: 50px;margin-top: 50px;">
            <div style="display: inline-block;width: 65px;">选择密级</div>
            <div style="display: inline-block;"><select name="" id="is_secrecy" style="width: 180px;height: 35px;">
                <option value="true">公开</option>
                <option value="false">私密</option>
            </select>
            </div>
        </div>

        <div style="margin-bottom: 20px;margin-left: 50px;">
            <div style="display: inline-block; width: 65px">选择员工</div>
            <div style="display: inline-block"><input type="text" id="person" style="width: 180px;height: auto;"
                                                      onclick="fill_val(this, ele_id=this.id, types=true)"></div>
        </div>
        <div style="text-align: center;margin-top: 120px">
            <button style="vertical-align: top; border: none; width: 100px; height: 32px;background: #1E90FF; border-radius: 3px; color: #FFFFFF;"
                    onclick="create_infomation()">提交
            </button>
        </div>
    </div>
    <div style="display: inline-block;vertical-align: top;width: 15%;height: 99%;background: white;margin-top: 5px;margin-left: 10px;">
        <div style="height: 40px;padding-left: 5px;border-bottom: #8c939d solid 1px;line-height: 40px;font-size: 16px;">
            <img src="../../static/personal_center/img/收文管理.png" style="width: 18px;height: 25px;margin-top: -8px;">
            文件分类
        </div>
        <div style="width: 95%;height: 35px;line-height: 35px;cursor: pointer;">
            <div data-value="true" class="onclick-search add-backbround-color" style="padding-left: 5px;">公开文件<span
                    style="padding: 4px 0; border-radius: 3px; font-size: 10px; float: right; background: #8c939d; width: 26px; height: 26px; margin-top: 5px; line-height: 20px; text-align: center; display: table-row;color: white;">
                {{ one_dict.公开 }}
            </span>
            </div>
        </div>
        <hr>
        <div style="width: 95%;height: 35px;line-height: 35px;cursor: pointer;">
            <div data-value="false" class="onclick-search" style="padding-left: 5px;">私密文件<span
                    style="padding: 4px 0; border-radius: 3px; font-size: 10px; float: right; background: #8c939d; width: 26px; height: 26px; margin-top: 5px; line-height: 20px; text-align: center; display: table-row;color: white;">{{ one_dict.私密 }}</span>
            </div>
        </div>
        <hr>
    </div>

    <div style="display: inline-block;vertical-align: top;width: 84%;height: 99%;margin-top: 5px;">
        <div class="headline">
            <section class="search-area">
                <div class="sa-ele" style="width: 20%;">
                    <input class="se-con" name="user" placeholder="输入部门或者发布人"
                           style="width: 100%;height: 30px;border-radius: 3px;">
                </div>
                <div class="sa-ele" style="width: 7%;">
                    <button class="search-action" style="width: 100%;height: 30px;border-radius: 3px;">搜索
                    </button>
                </div>
                <div style="display: inline-block; text-align: right; width: 70%">
                    <div style="display: inline-block; margin-right: 10px">
                        <button class="button button4" type="button" title="上传" onclick="UPLOAD()">
                                <span style="text-align: center; ">上传文件</span>
                        </button>
                    </div>
                </div>

            </section>
        </div>
        <!-- 上传附件 -->
        <div id="upload_doc_model"
             style="display: none; width: 35%; height: 40%; position: absolute; background: #ffffff; border: #ccc solid 1px; border-radius: 20px; z-index: 999; top: 20%; left: 47%">
            <div style="margin: 0; height: 40px; background: #e6e6e6; border-radius: 20px 20px 0 0; text-align: right; padding-right: 15px; line-height: 40px; font-size: 25px">
                <span style="cursor: pointer;height: 40px" onclick="close_window()">×</span>
            </div>
            <div style="margin: 5% 50px;border-radius: 3px 0 0 5px;font-size: 0;">
                <a href="javascript:;" class="file" style="vertical-align: top;display: inline-block;font-size: 14px;">
                    上传文件
                    <input type="file" name="party_main_body" id="party_main_body" onchange="upload_accessory_name()">
                </a>
                <input type="text"
                       style="display: inline-block;vertical-align: top;width: 84%;height: 30px;border: #99D3F5 solid 1px;border-bottom-right-radius: 4px;border-top-right-radius: 4px;border-left: none;font-size: 14px;padding-left: 5px;"
                       id="party_main_body_name" disabled>
            </div>

            <div style="margin: 5% 50px;">

                <div style="display: inline-block; width: 100%">
                    <span style="margin-right: 15px">选择密级: </span>
                    <select name="" id="select_Lv"
                            style="width:85%; height: 30px; outline: none; border: #99D3F5 solid 1px">
                        <option value="false">私密</option>
                        <option value="true">公开</option>
                    </select>
                </div>
            </div>
            <div style="text-align: center; margin-top: 15%">
                <button onclick="upload_accessory('file', 'main_body', 'party_main_body')"
                        style="width: 100px; height: 30px; border-radius: 3px; background: #1E90FF; color: white; border: none">
                    提交
                </button>
            </div>
        </div>

        <div id="my_application" style="width: 100%;height: 95.3%;overflow: auto;background-color: white;">
            <div class="right-box" style="width: 100%;height: 100%;margin-top: 0;">
                <div style="height: 100%;width: 100%;overflow: auto;border-bottom: #cccccc solid 1px;background-color: white;">
                    <section class="grid-main">
                        <table id="main_table"></table>
                    </section>
                </div>
            </div>
        </div>
    </div>


{% endblock %}

{% block script %}
    <script type="text/javascript" src="../../static/administrative/js/layer.js"></script>
    <script>
        window.onload = function () {
            document.getElementById("loading").style.display = "none";
            document.getElementById("doc_management").className = "add_class";
            document.getElementById("personal_doc").className = "add-nav-active";
        };
        var data_value_temp = ''

        function select_all_option(tag) {
            var button_li = document.getElementsByClassName('checkbox_file');
            for (var i = 0; i < button_li.length; i++) {
                button_li[i].checked = "true";
            }
            console.log(button_li)
        }

        const gridManagerName = "test",
            TYPE_MAP = {1: "HTML/CSS", 2: "nodeJS", 3: "javaScript", 4: "前端鸡汤", 5: "PM Coffee", 6: "前端框架", 7: "前端相关"},
            GM_PUBLISH_METHOD_MAP = {
                init: {key: "init", relyInit: !1, title: "初始化", code: 'demo1.initGM(document.querySelector("table"));'},
                get: {key: "get", relyInit: !0, title: "获取表格的实时配置信息", code: `GridManager.get('${gridManagerName}');`},
                version: {key: "version", relyInit: !1, title: "获取当前GridManager的版本号", code: "GridManager.version;"},
                getLocalStorage: {
                    key: "getLocalStorage",
                    relyInit: !0,
                    title: "获取表格用户记忆",
                    code: `GridManager.getLocalStorage('${gridManagerName}');`
                },
                resetLayout: {
                    key: "resetLayout",
                    relyInit: !0,
                    title: "重置表格布局",
                    code: `GridManager.resetLayout('${gridManagerName}', '800px', '500px');`
                },
                clear: {
                    key: "clear",
                    relyInit: !0,
                    title: "清除表格记忆数据",
                    code: `GridManager.clear('${gridManagerName}');`
                },
                getTableData: {
                    key: "getTableData",
                    relyInit: !0,
                    title: "获取指定tr所使用的数据",
                    code: `GridManager.getTableData('${gridManagerName}');`
                },
                getRowData: {
                    key: "getRowData",
                    relyInit: !0,
                    title: "获取指定tr所使用的数据",
                    code: `GridManager.getRowData('${gridManagerName}', document.querySelector("table[grid-manager=${gridManagerName}] tbody tr"));`
                },
                updateRowData: {
                    key: "updateRowData",
                    relyInit: !0,
                    title: "更新指定行所使用的数据",
                    code: `GridManager.updateRowData('${gridManagerName}', 'id', {id: 112, title: 'ccc'});`
                },
                updateTreeState: {
                    key: "updateTreeState",
                    relyInit: !0,
                    title: "更新树的展开状态",
                    code: `GridManager.updateTreeState('${gridManagerName}', true);`
                },
                setSort: {
                    key: "setSort",
                    relyInit: !0,
                    title: "手动设置排序",
                    code: `GridManager.setSort('${gridManagerName}', {createDate: 'ASC'});`
                },
                setConfigVisible: {
                    key: "setConfigVisible",
                    relyInit: !0,
                    title: "设置表头配置区域可视状态",
                    code: `GridManager.setConfigVisible('${gridManagerName}', true);`
                },
                setLineHeight: {
                    key: "setLineHeight",
                    relyInit: !0,
                    title: "配置行的高度",
                    code: `GridManager.setLineHeight('${gridManagerName}', '70px');`
                },
                showTh: {
                    key: "showTh",
                    relyInit: !0,
                    title: "设置列为可视状态",
                    code: `GridManager.showTh('${gridManagerName}', 'pic');`
                },
                hideTh: {
                    key: "hideTh",
                    relyInit: !0,
                    title: "设置列为隐藏状态",
                    code: `GridManager.hideTh('${gridManagerName}', 'pic');`
                },
                exportGrid: {
                    key: "exportGrid",
                    relyInit: !0,
                    title: "导出指定表格",
                    code: `GridManager.exportGrid('${gridManagerName}', 'demo中使用的导出').then(res=>{console.log('success')}).catch(err=>{console.error('error', err)});`
                },
                setQuery: {
                    key: "setQuery",
                    relyInit: !0,
                    title: "更改在生成组件时所配置的参数query",
                    code: `GridManager.setQuery('${gridManagerName}', {'userName':'baukh','sex':'男'});`
                },
                setAjaxData: {
                    key: "setAjaxData",
                    relyInit: !0,
                    title: "用于再次配置ajaxData数据",
                    code: `GridManager.setAjaxData('${gridManagerName}', {data: [{title: '通过setAjaxData动态添加的数据，其它项为空'}], totals: 1});`
                },
                refreshGrid: {
                    key: "refreshGrid",
                    relyInit: !0,
                    title: "刷新表格",
                    code: `GridManager.refreshGrid('${gridManagerName}');`
                },
                renderGrid: {
                    key: "renderGrid",
                    relyInit: !0,
                    title: "渲染表格",
                    code: `GridManager.renderGrid('${gridManagerName}');`
                },
                getCheckedTr: {
                    key: "getCheckedTr",
                    relyInit: !0,
                    title: "获取当前选中的行",
                    code: `GridManager.getCheckedTr('${gridManagerName}');`
                },
                getCheckedData: {
                    key: "getCheckedData",
                    relyInit: !0,
                    title: "获取选中行的渲染数据",
                    code: `GridManager.getCheckedData('${gridManagerName}');`
                },
                setCheckedData: {
                    key: "setCheckedData",
                    relyInit: !0,
                    title: "设置选中的数据",
                    code: `GridManager.setCheckedData('${gridManagerName}', [GridManager.getTableData('${gridManagerName}')[1]]);`
                },
                cleanData: {
                    key: "cleanData",
                    relyInit: !0,
                    title: "清除指定表格数据",
                    code: `GridManager.cleanData('${gridManagerName}');`
                },
                print: {key: "print", relyInit: !0, title: "打印当前页", code: `GridManager.print('${gridManagerName}');`},
                showRow: {
                    key: "showRow",
                    relyInit: !0,
                    title: "显示隐藏行",
                    code: `GridManager.showRow('${gridManagerName}', 1);`
                },
                hideRow: {
                    key: "hideRow",
                    relyInit: !0,
                    title: "隐藏行",
                    code: `GridManager.hideRow('${gridManagerName}', 1);`
                },
                showLoading: {
                    key: "showLoading",
                    relyInit: !0,
                    title: "显示加载中",
                    code: `GridManager.showLoading('${gridManagerName}');`
                },
                hideLoading: {
                    key: "hideLoading",
                    relyInit: !0,
                    title: "隐藏加载中",
                    code: `GridManager.hideLoading('${gridManagerName}', 300);`
                },
                destroy: {
                    key: "destroy",
                    relyInit: !0,
                    title: "消毁指定的GridManager实例",
                    code: `GridManager.destroy('${gridManagerName}');`
                }
            }, arg = {
                gridManagerName: "test",
                width: "100%",
                height: "100%",
                autoOrderConfig: {fixed: "left"},
                checkboxConfig: {key: "id", fixed: "left"},
                supportAjaxPage: !0,
                sortMode: "single",
                supportMenu: !0,
                menuHandler: e => (e.unshift({
                    content: "自定义菜单", line: !0, onClick: e => {
                        alert(e)
                    }
                }), e),
                useCellFocus: !0,
                useHideRow: !0,
                supportMoveRow: !0,
                moveRowConfig: {
                    key: "priority", useSingleMode: !0, fixed: "left", handler: (e, t) => {
                        console.log(e, t)
                    }
                },
                disableCache: !1,
                ajaxData: function (e, t) {
                    var local_host = window.location.host;          // 获取当前IP
                    return "/document-management/peresonal_document_view"
                },
                exportConfig: {
                    fileName: e => {
                        const t = new Date;
                        let a = `${t.getFullYear()}-${t.getMonth() + 1}-${t.getDate()}`;
                        for (let t in e) a = `${a}-${t}=${e[t]}`;
                        return a
                    }, suffix: "xls"
                },
                ajaxType: "POST",
                checkedBefore: function (e, t, a) {
                    return console.log("checkedBefore==", e, t, a), a && 90 === a.id && alert("该节点在checkedBefore中配置为不可选"), a && 90 !== a.id
                },
                checkedAfter: function (e, t, a) {
                    console.log("checkedAfter==", e, t, a)
                },
                checkedAllBefore: function (e, t) {
                    console.log("checkedAllBefore==", e, t)
                },
                checkedAllAfter: function (e, t) {
                    console.log("checkedAllAfter==", e, t)

                },
                sortingBefore: function (e) {
                    console.log("sortingBefore", e)
                },
                sortingAfter: function (e) {
                    console.log("sortingAfter", e)
                },
                ajaxBeforeSend: function (e) {
                    console.log("ajaxBeforeSend")
                },
                ajaxSuccess: function (e) {
                    console.log("ajaxSuccess")
                },
                ajaxError: function (e) {
                    console.log("ajaxError")
                },
                ajaxComplete: function (e) {
                    console.log("ajaxComplete")
                },
                adjustBefore: e => {
                    console.log("adjustBefore=>", e)
                },
                adjustAfter: e => {
                    console.log("adjustAfter=>", e)
                },
                responseHandler: e => (e.data.forEach((e => {
                    e.priority = e.id
                })), e),
                rowRenderHandler: (e, t) => e,
                emptyTemplate: e => `<div style="text-align: center;">${e.query.title ? "搜索为空" : "暂无数据"}</div>`,
                columnData: [
                    {
                        key: "doc_name",
                        text: "文件名称",
                        align: "center",
                        disableMoveRow: !0
                    }, {
                        key: "file_size",
                        text: "文件大小",
                        align: "center",
                    }, {
                        key: "doc_depart",
                        text: "所属部门",
                        align: "center",
                    }, {
                        key: "user",
                        text: "发布人",
                        align: "center",
                    }, {
                        key: "upload_time",
                        text: "上传时间",
                        align: "center",
                    }, {
                        key: "action",
                        width: "100px",
                        align: "center",
                        fixed: "right",
                        disableMoveRow: !0,
                        disableRowCheck: !0,
                        text: '<span style="color: red">操作</span>',
                        template: (e, t) => `<a class="plugin-action" target="_blank" id="${t.id}" href="${t.file_path}" onclick="">查看</a> |
                        <a class="plugin-action" id="${t.id}" onclick="view_details(this.id)">修改</a>`
                    }]
            }, demo1 = {
                initSearch: function () {
                    document.querySelector(".search-action").addEventListener("click", (function () {
                        change_color(data_value_temp);
                        var e = {
                            search_value: document.querySelector('[name="user"]').value,
                            datavalue: data_value_temp,
                        };
                        table.GM("setQuery", e, (function () {
                            console.log("setQuery执行成功", e)
                        }))
                    }))
                }, initFN: () => {

                }, initGM: function () {
                    new window.GridManager(table, arg, (e => {
                        console.log("渲染完成后的回调函数:", e), console.log(arg.columnData)
                    }))
                }, editRowData: function (e) {
                    window.GridManager.updateRowData("test", "id", {
                        id: window.parseInt(e.getAttribute("data-id")),
                        lastDate: (new Date).getTime()
                    })
                }
            }, table = document.querySelector("#main_table");
        demo1.initSearch(table), demo1.initGM(table), demo1.initFN();

        var onlick_list = document.getElementsByClassName("onclick-search");

        for (var i = 0; i < onlick_list.length; i++) {
            onlick_list[i].onclick = function () {
                change_color(this.getAttribute("data-value"));
                data_value_temp = this.getAttribute("data-value")
                var e = {
                    datavalue: this.getAttribute("data-value")
                };
                table.GM("setQuery", e, (function () {
                    console.log("setQuery执行成功")
                }))
            }
        }

        function change_color(datavalue) {
            for (var j = 0; j < onlick_list.length; j++) {
                if (onlick_list[j].getAttribute("data-value") === datavalue) {
                    onlick_list[j].className = "onclick-search add-backbround-color";
                } else {
                    onlick_list[j].className = "onclick-search";
                }
            }
        }

        function UPLOAD() {
            document.getElementById('upload_doc_model').style.display = 'inline-block';
        }

        function close_window() {
            document.getElementById('upload_doc_model').style.display = 'none';
        }

        // 上传正文
        function upload_accessory(file_type, tbody_id, accessory_type) {
            document.getElementById("loading").style.display = "inline-block";
            var form = new FormData();
            var files = document.getElementById(accessory_type).files[0];  // 获取文件
            var xhr = new XMLHttpRequest();
            var local_host = window.location.host;          // 获取当前IP
            if (!files) {
                alert("请选择需要上传的文件！")
                window.location.href = '/document-management/peresonal_document_view';
                return false
            }
            var is_secrecy = $('#select_Lv').val()          // 获取密级是否公开， true 公开，false 私密
            form.append('file', files);
            form.append("is_secrecy", is_secrecy)

            xhr.open('post', "/administrative/personal_attachments_upload", true);
            xhr.send(form);
            xhr.onreadystatechange = function () {
                if (xhr.readyState === 4) {
                    if (xhr.status === 200) {
                        document.getElementById("loading").style.display = "none";
                        var JsonDate = JSON.parse(xhr.responseText);
                        if (JsonDate["code"] === 400) {
                            alert("请上传xlsx格式文件！")
                        }
                        window.location.href = '/document-management/peresonal_document_view';
                    }
                }
            };
        }

        function upload_accessory_name() {
            document.getElementById("party_main_body_name").value = document.getElementById("party_main_body").value.split("\\")[document.getElementById("party_main_body").value.split("\\").length - 1];
        }

        function close_models_1() {
            document.getElementById('on_load').style.display = 'none';
        }

        function view_details(ele_id) {
            document.getElementById('on_load').style.display = 'inline-block';
            document.getElementById('on_load').setAttribute('data_value', ele_id);
        }

        function fill_val(obj, ele_id, types = false, job_numbers = false) {
            document.getElementById("new_models").style.display = "table";
            var id = ele_id;
            sessionStorage.clear();
            document.getElementById("an_branch").style.color = "#01aaed";   // 按部门
            document.getElementById("an_rank").style.color = "#0b0b0b";     // 按权限
            document.getElementById("an_func").style.color = "#0b0b0b";     // 按职能
            document.getElementById("all_select_checkbox").checked = false; // 右侧弹框
            var check_box_list = document.getElementsByClassName("check_box");
            document.getElementById("search_button").setAttribute("onclick", "search_data()");
            document.getElementById("an_branch").setAttribute("onclick", "change_left_val(this.id)");
            document.getElementById("an_rank").setAttribute("onclick", "change_left_val(this.id)");
            document.getElementById("an_func").setAttribute("onclick", "change_left_val(this.id)");
            for (var t = 0; t < check_box_list.length; t++) {
                document.getElementById(check_box_list[t].id).checked = false;
            }
            document.getElementById("checked-label").innerHTML = "";

            document.getElementById("model-affirm").setAttribute("onclick", "summit_val1(" + id + ")");
            document.getElementById("model_title").innerText = "选择审批人";

            deltr1();
            document.getElementById("img-display1").style.display = "inline-block";
            if (window.branch_list) {
                var branch_list = window.branch_list;
                var department_list = document.getElementById("department_list");
                department_list.innerHTML = "";
                var ul_tag = document.createElement("ul");
                ul_tag.style.fontSize = "0";
                ul_tag.style.margin = "0";
                ul_tag.style.padding = "0";
                for (var i = 0; i < branch_list.length; i++) {
                    var li_tag = document.createElement("li");
                    li_tag.style.fontSize = "14px";
                    li_tag.style.margin = "0";
                    li_tag.style.padding = "0";
                    li_tag.innerHTML = "<p style='margin-left: 20%;'>" + branch_list[i] + "</p>";
                    li_tag.setAttribute("onclick", "choice_peopel('" + branch_list[i] + "')");
                    li_tag.setAttribute("id", branch_list[i]);
                    li_tag.className = "li-class";
                    ul_tag.appendChild(li_tag);
                    department_list.appendChild(ul_tag);
                }
            } else {
                var xhr = new XMLHttpRequest();
                var local_host = window.location.host;          // 获取当前IP
                xhr.open('post', "/technological/delegation", true);
                xhr.setRequestHeader('content-type', 'application/x-www-form-urlencoded');
                xhr.send();
                xhr.onreadystatechange = function () {
                    if (xhr.readyState === 4) {
                        if (xhr.status === 200) {
                            var JsonDate = JSON.parse(xhr.responseText);
                            window.personnel_list = JsonDate["data"];
                            window.emp_info_dict = JsonDate["emp_info_dict"];
                            window.people_dict = JsonDate["people_dict"];
                            window.people_dict_new = JsonDate["people_dict_new"];
                            window.branch_list = JsonDate["branch_list"];
                            window.function_list = JsonDate["function_list"];
                            var department_list = document.getElementById("department_list");
                            department_list.innerHTML = "";
                            var ul_tag = document.createElement("ul");
                            ul_tag.style.fontSize = "0";
                            ul_tag.style.margin = "0";
                            ul_tag.style.padding = "0";
                            for (var i = 0; i < JsonDate["branch_list"].length; i++) {
                                var li_tag = document.createElement("li");
                                li_tag.style.fontSize = "14px";
                                li_tag.style.margin = "0";
                                li_tag.style.padding = "0";
                                li_tag.innerHTML = "<p style='margin-left: 20%;'>" + JsonDate["branch_list"][i] + "</p>";
                                li_tag.setAttribute("onclick", "choice_peopel('" + JsonDate["branch_list"][i] + "')");
                                li_tag.setAttribute("id", JsonDate["branch_list"][i]);
                                li_tag.className = "li-class";
                                ul_tag.appendChild(li_tag);
                                department_list.appendChild(ul_tag);
                            }
                        }
                    }
                }
            }
        }

        function choice_peopel(choice_key, chose_id) {
            var data_str = sessionStorage.getItem(choice_key);
            var data_list = [];
            if (data_str) {
                data_list = data_str.split(",")
            }
            var emp_info_dict = window.emp_info_dict;
            document.getElementById("img-display1").style.display = "none";
            var t_table = document.getElementById("t_table2");
            if (document.getElementsByClassName("li-class add_background").length > 0) {
                var old_tag_id = document.getElementsByClassName("li-class add_background")[0].id;
                document.getElementById(old_tag_id).className = "li-class";
            }
            document.getElementById(choice_key).className = "li-class add_background";
            deltr1();
            document.getElementById("all_select_checkbox").checked = false;
            document.getElementById("all_select_checkbox").setAttribute("onclick", "check_all_select('" + choice_key + "', '" + chose_id + "')");

            for (var i = 0; i < emp_info_dict[choice_key].length; i++) {
                var elm = emp_info_dict[choice_key]
                var tr = document.createElement("tr");
                var td = document.createElement("td");
                var td1 = document.createElement("td");
                var td2 = document.createElement("td");
                var td3 = document.createElement("td");
                td.innerHTML = "<input id='" + elm[i].real_name + "(" + elm[i].job_number + ')' + "' class='check_box' type=\"checkbox\" onclick='choice_consignor(this.id, \"" + chose_id + "\"" + ", \"" + choice_key + "\")'>";
                td.style.textAlign = "center";
                td1.innerHTML = i + 1;
                td1.style.textAlign = "center";
                td2.innerHTML = elm[i].real_name;
                td2.title = elm[i].real_name;
                td2.style.textAlign = "center";
                td3.innerHTML = elm[i].job_number;
                td3.title = elm[i].job_number;
                td3.style.textAlign = "center";
                tr.appendChild(td);
                tr.appendChild(td1);
                tr.appendChild(td2);
                tr.appendChild(td3);
                t_table.appendChild(tr);
            }

            var tttt = 0;
            if (data_list) {
                if (data_list[0] === "all") {
                    document.getElementById("all_select_checkbox").checked = true;
                    tttt = 1
                }
            }
            for (var III = tttt; III < data_list.length; III++) {
                document.getElementById(data_list[III].trim()).checked = true;
            }
        }

        // 创建右侧选择人员列表
        function choice_peopel_1(choice_key, chose_id) {
            var data_str = sessionStorage.getItem(choice_key);
            var data_list = [];
            if (data_str) {
                data_list = data_str.split(",")
            }
            var people_dict = window.people_dict;
            var people_dict_new = window.people_dict_new;
            document.getElementById("img-display1").style.display = "none";
            var t_table = document.getElementById("t_table2");
            if (document.getElementsByClassName("li-class add_background").length > 0) {
                var old_tag_id = document.getElementsByClassName("li-class add_background")[0].id;
                document.getElementById(old_tag_id).className = "li-class";
            }
            document.getElementById(choice_key).className = "li-class add_background";
            deltr1();
            document.getElementById("all_select_checkbox").checked = false;
            document.getElementById("all_select_checkbox").setAttribute("onclick", "check_all_select('" + choice_key + "', 'executor2')")
            for (var i = 0; i < people_dict_new[choice_key].length; i++) {
                var elm = people_dict_new[choice_key];
                var tr = document.createElement("tr");
                var td = document.createElement("td");
                var td1 = document.createElement("td");
                var td2 = document.createElement("td");
                var td3 = document.createElement("td");
                td.innerHTML = "<input id='" + elm[i].real_name + '(' + elm[i].job_number + ')' + "' class='check_box' type=\"checkbox\" onclick='choice_consignor(this.id, \"" + chose_id + "\"" + ", \"" + choice_key + "\")'>";
                td.style.textAlign = "center";
                td1.innerHTML = i + 1;
                td1.style.textAlign = "center";
                td2.innerHTML = elm[i].real_name;
                td2.title = elm[i].real_name;
                td2.style.textAlign = "center";
                td3.innerHTML = elm[i].job_number;
                td3.title = elm[i].job_number;
                td3.style.textAlign = "center";
                tr.appendChild(td);
                tr.appendChild(td1);
                tr.appendChild(td2);
                tr.appendChild(td3);
                t_table.appendChild(tr);
            }
            var tttt = 0;
            if (data_list) {
                if (data_list[0] === "all") {
                    document.getElementById("all_select_checkbox").checked = true;
                    tttt = 1
                }
            }
            for (var III = tttt; III < data_list.length; III++) {
                document.getElementById(data_list[III].trim()).checked = true;
            }
        }

        // 创建右侧选择人员列表
        function choice_peopel_2(choice_key, chose_id) {
            var data_str = sessionStorage.getItem(choice_key);
            var data_list = [];
            if (data_str) {
                data_list = data_str.split(",")
            }

            var people_dict_new = window.function_list;
            document.getElementById("img-display1").style.display = "none";
            var t_table = document.getElementById("t_table2");
            if (document.getElementsByClassName("li-class add_background").length > 0) {
                var old_tag_id = document.getElementsByClassName("li-class add_background")[0].id;
                document.getElementById(old_tag_id).className = "li-class";
            }
            document.getElementById(choice_key).className = "li-class add_background";
            deltr1();
            document.getElementById("all_select_checkbox").checked = false;
            document.getElementById("all_select_checkbox").setAttribute("onclick", "check_all_select('" + choice_key + "', 'executor2')")
            for (var i = 0; i < people_dict_new[choice_key].length; i++) {
                var elm = people_dict_new[choice_key];
                var tr = document.createElement("tr");
                var td = document.createElement("td");
                var td1 = document.createElement("td");
                var td2 = document.createElement("td");
                var td3 = document.createElement("td");
                td.innerHTML = "<input id='" + elm[i].real_name + '(' + elm[i].job_number + ')' + "' class='check_box' type=\"checkbox\" onclick='choice_consignor(this.id, \"" + chose_id + "\"" + ", \"" + choice_key + "\")'>";
                td.style.textAlign = "center";
                td1.innerHTML = i + 1;
                td1.style.textAlign = "center";
                td2.innerHTML = elm[i].real_name;
                td2.title = elm[i].real_name;
                td2.style.textAlign = "center";
                td3.innerHTML = elm[i].job_number;
                td3.title = elm[i].job_number;
                td3.style.textAlign = "center";
                tr.appendChild(td);
                tr.appendChild(td1);
                tr.appendChild(td2);
                tr.appendChild(td3);
                t_table.appendChild(tr);
            }
            var tttt = 0;
            if (data_list) {
                if (data_list[0] === "all") {
                    document.getElementById("all_select_checkbox").checked = true;
                    tttt = 1
                }
            }
            for (var III = tttt; III < data_list.length; III++) {
                document.getElementById(data_list[III].trim()).checked = true;
            }
        }

        function create_table1(json_data) {
            var t_table = document.getElementById("t_table1");
            var menu_name = "";
            var mwnu_num = 0;
            var menu_num = 1;
            for (var i = 0; i < json_data.length; i++) {
                var tr = document.createElement("tr");
                var td = document.createElement("td");
                var td1 = document.createElement("td");
                var td2 = document.createElement("td");
                var td3 = document.createElement("td");
                var td4 = document.createElement("td");
                if (json_data[i]["menu"] !== menu_name) {
                    menu_name = json_data[i]["menu"];
                    mwnu_num += 1;
                    menu_num = 1;
                    var tr_1 = document.createElement("tr");
                    var td_1 = document.createElement("td");
                    var td1_1 = document.createElement("td");
                    var td2_1 = document.createElement("td");
                    var td3_1 = document.createElement("td");
                    td_1.innerHTML = '<a href="#" onclick="menu_contraction(\'' + "0" + String(mwnu_num) + '\', \'' + "0" + String(mwnu_num) + '\')"><i id="' + "0" + String(mwnu_num) + '" class="iconfont icon-sanjiaoyou"></i> ' + menu_name + '</a>';
                    td_1.style.paddingLeft = "1%";
                    td1_1.innerHTML = "0" + String(mwnu_num);
                    td1_1.style.paddingLeft = "3.5%";
                    td2_1.innerHTML = "有效";
                    td2_1.style.textAlign = "center";
                    td3_1.innerHTML = '<p onclick="padding_data(\'' + json_data[i]["menu"] + '\')"><i  class="iconfont icon-zhucetianjiahaoyou"></i> 添加</p>';
                    td3_1.style.textAlign = "center";
                    td3_1.style.color = "#0c6fd9";
                    td3_1.style.cursor = "pointer";
                    tr_1.appendChild(td_1);
                    tr_1.appendChild(td1_1);
                    tr_1.appendChild(td2_1);
                    tr_1.appendChild(td3_1);
                    t_table.appendChild(tr_1);


                    tr.className = "0" + String(mwnu_num);
                    tr.style.display = "none";
                    td.innerHTML = '<a href="#">' + json_data[i]["bill"] + '</a>';
                    td.style.paddingLeft = "3%";
                    td1.innerHTML = "0" + String(mwnu_num) + "-" + String(menu_num);
                    td1.style.paddingLeft = "3.5%";
                    td2.innerHTML = "有效";
                    td2.style.textAlign = "center";
                    td3.innerHTML = '/';
                    td3.style.textAlign = "center";
                    td3.style.color = "#0c6fd9";
                    td3.style.cursor = "pointer";
                    menu_num += 1
                } else {
                    tr.className = "0" + String(mwnu_num);
                    tr.style.display = "none";
                    td.innerHTML = '<a href="#">' + json_data[i]["bill"] + '</a>';
                    td.style.paddingLeft = "3%";
                    td1.innerHTML = "0" + String(mwnu_num) + "-" + String(menu_num);
                    td1.style.paddingLeft = "3.5%";
                    td2.innerHTML = "有效";
                    td2.style.textAlign = "center";
                    td3.innerHTML = '/';
                    td3.style.textAlign = "center";
                    td3.style.color = "#0c6fd9";
                    td3.style.cursor = "pointer";
                    menu_num += 1
                }

                tr.appendChild(td);
                tr.appendChild(td1);
                tr.appendChild(td2);
                tr.appendChild(td3);
                t_table.appendChild(tr);
            }
        }

        // 删除列表
        function deltr() {
            var tb = document.getElementById('t_table');
            var rowNum = tb.rows.length;
            for (i = 0; i < rowNum; i++) {
                tb.deleteRow(i);
                rowNum = rowNum - 1;
                i = i - 1;
            }
        }

        // 删除列表
        function deltr1() {
            var tb = document.getElementById('t_table2');
            var rowNum = tb.rows.length;
            for (i = 0; i < rowNum; i++) {
                tb.deleteRow(i);
                rowNum = rowNum - 1;
                i = i - 1;
            }
        }

        // 删除列表
        function deltr2() {
            var tb = document.getElementById('t_table1');
            var rowNum = tb.rows.length;
            for (i = 0; i < rowNum; i++) {
                tb.deleteRow(i);
                rowNum = rowNum - 1;
                i = i - 1;
            }
        }

        // 选择委托人
        function choice_consignor(ele_id, chose_id, choice_key) {
            chose_id = 'executor2';
            if (chose_id === "executor2" || chose_id === "executor4") {
                var dataStr = sessionStorage.getItem(choice_key);
                var dataList = [];
                if (dataStr) {
                    sessionStorage.setItem(choice_key, dataStr + ", " + ele_id)
                } else {
                    sessionStorage.setItem(choice_key, ele_id)
                }

                if (chose_id === "executor2") {
                    var tag_id = "executor_str";
                } else {
                    tag_id = "executor_str1";
                }
                var executor_str = document.getElementById(tag_id);
                if (executor_str) {
                    if (document.getElementById(ele_id).checked) {
                        if (executor_str.innerText.trim()) {
                            document.getElementById(tag_id).innerHTML = executor_str.innerText + ", " + ele_id;
                        } else {
                            document.getElementById(tag_id).innerHTML = ele_id;
                        }
                    } else {
                        var str_push = [];
                        var executor_list = executor_str.innerText.split(", ");
                        for (var kl = 0; kl < executor_list.length; kl++) {
                            if (executor_list[kl] !== ele_id) {
                                str_push.push(executor_list[kl])
                            }
                        }
                        document.getElementById(tag_id).innerHTML = str_push.join(", ")
                    }
                } else {
                    document.getElementById("checked-label").innerHTML = "<span id='" + tag_id + "' style='margin-left: 1%;width: 100%;'>" + ele_id + "</span>";
                }
            } else {
                check_more_one_not(ele_id);
                document.getElementById("checked-label").innerHTML = "<span id='" + tag_id + "' style='margin-left: 1%;'>" + ele_id + "</span>";
            }

        }

        // 复选框全选
        function check_all_select(choice_key, chose_id) {
            var select_check = document.getElementById("all_select_checkbox").checked;
            var all_check_box = document.getElementsByClassName("check_box");
            chose_id = 'executor2'
            if (chose_id === "executor2") {
                var tag_id = "executor_str";
            } else {
                tag_id = "executor_str1";
            }

            var executor_list = [];
            var executor_str = document.getElementById(tag_id);
            if (executor_str) {
                if (executor_str.innerText.trim()) {
                    executor_list = executor_str.innerText.split(", ")
                }
            }

            var new_check_val_list = [];
            var check_val_list = [];
            for (var HH = 0; HH < all_check_box.length; HH++) {
                all_check_box[HH].checked = true;
                check_val_list.push(all_check_box[HH].id);
                if (executor_list.lastIndexOf(all_check_box[HH].id) === -1) {
                    new_check_val_list.push(all_check_box[HH].id)
                }
            }

            if (select_check) {
                if (chose_id === "executor2" || chose_id === "executor4") {

                    if (executor_str) {
                        if (executor_str.innerText.trim()) {
                            document.getElementById(tag_id).innerHTML = executor_str.innerText + ", " + new_check_val_list.join(", ");
                        } else {
                            document.getElementById(tag_id).innerHTML = new_check_val_list.join(", ");
                        }

                    } else {
                        document.getElementById("checked-label").innerHTML = "<span id='" + tag_id + "' style='margin-left: 1%;width: 100%;'>" + check_val_list.join(", ") + "</span>";
                    }
                    sessionStorage.setItem(choice_key, "all" + ", " + check_val_list.join(", "))
                } else {
                    alert("该节点不能多选！");
                    document.getElementById("all_select_checkbox").checked = false;
                }
            } else {
                sessionStorage.removeItem(choice_key);
                check_val_list = [];
                for (var II = 0; II < all_check_box.length; II++) {
                    all_check_box[II].checked = false;
                    check_val_list.push(all_check_box[II].id);
                }
                var old_check_val = document.getElementById(tag_id).innerHTML.split(", ");
                console.log(old_check_val)
                for (var TB = 0; TB < check_val_list.length; TB++) {
                    removeByValue(old_check_val, check_val_list[TB])
                }

                document.getElementById(tag_id).innerHTML = old_check_val.join(", ");
            }
        };

        function removeByValue(arr, val) {
            for (var i = 0; i < arr.length; i++) {
                if (arr[i] === val) {
                    arr.splice(i, 1);
                    break;
                }
            }
        };

        // checkBox不允许多选
        function check_more_one_not(ele_id) {
            var check_box_list = document.getElementsByClassName("check_box");
            for (var i = 0; i < check_box_list.length; i++) {
                if (String(check_box_list[i].id) !== String(ele_id)) {
                    document.getElementById(check_box_list[i].id).checked = false;
                } else {
                    document.getElementById(check_box_list[i].id).checked = true;
                }
            }
        }

        // 选择执行人
        function summit_val(id) {
            var executor111 = '';
            var checked_label = document.getElementById("checked-label");
            for (var j = 0; j < checked_label.children.length; j++) {
                executor111 = executor111 + checked_label.children[j].innerText.trim() + ", ";
            }
            document.getElementById("close-model").click();
            var executor = executor111.slice(0, -2);
            var page = document.getElementsByClassName("active")[0].innerText;
            document.getElementById("loading").style.display = "inline-block";
            var xhr = new XMLHttpRequest();
            var local_host = window.location.host;          // 获取当前IP

            xhr.open('get', "/personal-center/bill_group_view?page=" + String(page) + '&id=' + String(id) + '&executor=' + String(executor));
            xhr.setRequestHeader('content-type', 'application/x-www-form-urlencoded');
            xhr.setRequestHeader('Access-Control-Allow-Origin', '*');
            xhr.send();
            xhr.onreadystatechange = function () {
                if (xhr.readyState === 4) {
                    if (xhr.status === 200) {
                        document.getElementById("loading").style.display = "none";
                        var JsonDate = JSON.parse(xhr.responseText);
                        create_table(JsonDate["count"], JsonDate["bill_groups"]);
                        create_table1(JsonDate["bill_groups"]);
                        pagenum(JsonDate["count"], page);
                    }
                }
            };

        }

        function summit_val1(obj) {
            var executor111 = '';
            var checked_label = document.getElementById("checked-label");
            for (var j = 0; j < checked_label.children.length; j++) {
                executor111 = executor111 + checked_label.children[j].innerText.trim() + ", ";
            }
            var executor = executor111.slice(0, -2);
            document.getElementById(obj.id).value = executor;
            document.getElementById("new_models").style.display = "none";
        }

        // 加载分页条
        function pagenum(dataTotals = 1, page = 1) {
            new myPagination({
                id: 'pagination',
                curPage: page, //初始页码
                pageAmount: 20,  //每页多少条
                dataTotal: dataTotals, //总共多少条数据
                pageTotal: Math.ceil(parseInt(dataTotals, 10) / 20), //总页数
                pageSize: 5, //可选,分页个数
                showPageTotalFlag: true, //是否显示数据统计
                showSkipInputFlag: true, //是否支持跳转
                getPage: function (page) {
                    // var query_type = document.getElementById("query_type").value;
                    // var query_value = document.getElementById("query_value").value;
                    initialize(page);
                }
            });
        }

        function menu_contraction(contraction_num, Id_e) {
            var Issue_approval = document.getElementsByClassName(contraction_num);
            if (document.getElementById(Id_e).className === "iconfont icon-sanjiaoyou") {
                document.getElementById(Id_e).className = "iconfont icon-sanjiaoxia";
            } else {
                document.getElementById(Id_e).className = "iconfont icon-sanjiaoyou"
            }

            if (Issue_approval.length !== 0 && Issue_approval[0].style.display === "table-row") {
                for (var i = 0; i < Issue_approval.length; i++) {
                    Issue_approval[i].style.display = "none";
                }
            } else {
                for (var j = 0; j < Issue_approval.length; j++) {
                    Issue_approval[j].style.display = "table-row";
                }
            }

        }

        function change_left_val(ele_id) {
            if (ele_id === "an_rank") {
                document.getElementById("an_branch").style.color = "#0b0b0b";
                document.getElementById("an_func").style.color = "#0b0b0b";
                document.getElementById(ele_id).style.color = "#01aaed";
                deltr1();
                document.getElementById("img-display1").style.display = "inline-block";
                document.getElementById("department_list").innerHTML = "";
                var new_branch_list = ["书记、院长:A", "院领导:B", "职能科室负责人:C", "临床医技科室负责人:D", "副主任:G", "护士长:E", "普通员工:F"];
                var new_department_list = document.getElementById("department_list");
                var new_ul_tag = document.createElement("ul");
                new_ul_tag.style.fontSize = "0";
                new_ul_tag.style.margin = "0";
                new_ul_tag.style.padding = "0";
                for (var EF = 0; EF < new_branch_list.length; EF++) {
                    var new_li_tag = document.createElement("li");
                    new_li_tag.style.fontSize = "14px";
                    new_li_tag.style.margin = "0";
                    new_li_tag.style.padding = "0";
                    new_li_tag.style.paddingLeft = "5%";
                    new_li_tag.innerHTML = "<p>" + new_branch_list[EF].split(":")[0] + "</p>";
                    new_li_tag.setAttribute("onclick", "choice_peopel_1('" + new_branch_list[EF].split(":")[1] + "')");
                    new_li_tag.setAttribute("id", new_branch_list[EF].split(":")[1]);
                    new_li_tag.className = "li-class";
                    new_ul_tag.appendChild(new_li_tag);
                    new_department_list.appendChild(new_ul_tag);
                }
            } else if (ele_id === 'an_func') {
                document.getElementById("an_branch").style.color = "#0b0b0b";
                document.getElementById("an_rank").style.color = "#0b0b0b";
                document.getElementById(ele_id).style.color = "#01aaed";
                deltr1();
                document.getElementById("img-display1").style.display = "inline-block";
                document.getElementById("department_list").innerHTML = "";
                var department_list_1 = document.getElementById("department_list");
                var ul_tag_1 = document.createElement("ul");
                ul_tag_1.style.fontSize = "0";
                ul_tag_1.style.margin = "0";
                ul_tag_1.style.padding = "0";
                var function_list = window.function_list;
                var func_list = [];
                for (var tt in function_list['function_dict']) {
                    func_list.push(tt);
                }
                console.log(func_list)
                for (var AB = 0; AB < func_list.length; AB++) {
                    var new_li_1 = document.createElement("li");
                    new_li_1.style.fontSize = "14px";
                    new_li_1.style.margin = "0";
                    new_li_1.style.padding = "0";
                    new_li_1.style.paddingLeft = "5%";
                    new_li_1.innerHTML = "<p>" + func_list[AB] + "</p>";
                    new_li_1.setAttribute("onclick", "choice_peopel_2('" + function_list['function_dict'][func_list[AB]] + "')");
                    new_li_1.setAttribute("id", function_list['function_dict'][func_list[AB]]);
                    new_li_1.className = "li-class";
                    ul_tag_1.appendChild(new_li_1);
                    department_list_1.appendChild(ul_tag_1);
                }
            } else {
                document.getElementById("an_rank").style.color = "#0b0b0b";
                document.getElementById("an_func").style.color = "#0b0b0b";
                document.getElementById(ele_id).style.color = "#01aaed";
                deltr1();
                document.getElementById("img-display1").style.display = "inline-block";
                document.getElementById("department_list").innerHTML = "";
                var branch_list = window.branch_list;
                var department_list = document.getElementById("department_list");
                department_list.innerHTML = "";
                var ul_tag = document.createElement("ul");
                ul_tag.style.fontSize = "0";
                ul_tag.style.margin = "0";
                ul_tag.style.padding = "0";
                for (var i = 0; i < branch_list.length; i++) {
                    var li_tag = document.createElement("li");
                    li_tag.style.fontSize = "14px";
                    li_tag.style.margin = "0";
                    li_tag.style.padding = "0";
                    li_tag.innerHTML = "<p style='margin-left: 20%;'>" + branch_list[i] + "</p>";
                    li_tag.setAttribute("onclick", "choice_peopel('" + branch_list[i] + "')");
                    li_tag.setAttribute("id", branch_list[i]);
                    li_tag.className = "li-class";
                    ul_tag.appendChild(li_tag);
                    department_list.appendChild(ul_tag);
                }
            }
        }

        function search_data() {
            var searchData = document.getElementById("search_data").value;
            let emp_info_dict = window.emp_info_dict;
            var searchValNum = 1;
            var t_table = document.getElementById("t_table2");
            t_table.innerHTML = '';
            for (var i in emp_info_dict) {
                for (var j = 0; j < emp_info_dict[i].length; j++) {
                    if (emp_info_dict[i][j]['real_name'].indexOf(searchData) !== -1) {
                        var elm = emp_info_dict[i];
                        var tr = document.createElement("tr");
                        var td = document.createElement("td");
                        var td1 = document.createElement("td");
                        var td2 = document.createElement("td");
                        var td3 = document.createElement("td");
                        td.innerHTML = "<input id='" + elm[j].real_name + "(" + elm[j].job_number + ')' + "' class='check_box' type=\"checkbox\" onclick='choice_consignor(this.id, \"" + i + "\")'>";
                        td.style.textAlign = "center";
                        td1.innerHTML = searchValNum;
                        td1.style.textAlign = "center";
                        td2.innerHTML = elm[j].real_name;
                        td2.title = elm[j].real_name;
                        td2.style.textAlign = "center";
                        td3.innerHTML = elm[j].job_number;
                        td3.title = elm[j].job_number;
                        td3.style.textAlign = "center";
                        tr.appendChild(td);
                        tr.appendChild(td1);
                        tr.appendChild(td2);
                        tr.appendChild(td3);
                        t_table.appendChild(tr);
                        searchValNum += 1;
                        document.getElementById("img-display1").style.display = "none";
                    }
                }
            }
        }

        function close_models() {
            document.getElementById("new_models").style.display = "none";
        }

        function create_infomation() {
            var id = $("#on_load").attr('data_value');
            var is_secrecy = $("#is_secrecy").val();
            var watched_users = $("#person").val();
            var xhr = new XMLHttpRequest();
            var local_host = window.location.host;          // 获取当前IP
            xhr.open('post', "/document-management/peresonal_document_write_view", true);
            xhr.setRequestHeader('content-type', 'application/x-www-form-urlencoded');
            xhr.setRequestHeader('Access-Control-Allow-Origin', '*');
            xhr.send('id=' + id + "&is_secrecy=" + is_secrecy + '&watched_users=' + watched_users);
            xhr.onreadystatechange = function () {
                if (xhr.readyState === 4) {
                    if (xhr.status === 200) {
                        document.getElementById("loading").style.display = "none";
                        alert('修改成功！')
                        window.location.href = "/document-management/peresonal_document_view";
                    } else {
                        alert('修改失败!')
                    }
                }
            };
        }

        var box = document.getElementById('box');
        var isDown = false;
        var mouse = {};
        box.onmousedown = (e) => {
            isDown = true;
            isDown_1 = false;
            //保存初始位置
            mouse = {
                startX: e.clientX,
                startY: e.clientY,
                offsetLeft: box.offsetLeft,
                offsetTop: box.offsetTop,
            }
        };

        box.onmousemove = (e) => {
            if (!isDown) {
                return
            }
            //计算偏移位置
            var offsetLeft = mouse.offsetLeft + e.clientX - mouse.startX;
            var offsetTop = mouse.offsetTop + e.clientY - mouse.startY;

            //设置偏移距离的范围[0,window.innerWidth - 400]
            offsetLeft = Math.max(0, Math.min(offsetLeft, window.innerWidth - 400));
            offsetTop = Math.max(0, Math.min(offsetTop, window.innerHeight - 400));

            box.style.left = offsetLeft + 'px';
            box.style.top = offsetTop + 'px';

        };
        //当鼠标滑的太快时，容易移出box，所以在window上监听此事件
        window.onmouseup = () => {
            isDown = false;
            box.style.cursor = 'default';
            mouse = null;
        };

    </script>
{% endblock %}